//
//  MTBackPlayCell.m
//  MeToo
//
//  Created by 俊松何 on 2018/8/1.
//  Copyright © 2018年 tianxie. All rights reserved.
//

#import "MTBackPlayCell.h"

@interface MTBackPlayCell ()

@property (weak, nonatomic) IBOutlet UIButton *headerButton;
@property (weak, nonatomic) IBOutlet UIButton *deleteButton;

@property (weak, nonatomic) IBOutlet UIImageView *coverImageView;
@property (weak, nonatomic) IBOutlet UILabel *nameLabel;

@property (weak, nonatomic) IBOutlet UILabel *titleLable;

@end

@implementation MTBackPlayCell

- (void)awakeFromNib {
    [super awakeFromNib];
    self.headerButton.layer.masksToBounds = YES;
    self.headerButton.layer.cornerRadius = 20;
    self.selectionStyle = UITableViewCellSelectionStyleNone;
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];
}


-(void)setLiveModel:(MTLiveModel *)liveModel
{
    _liveModel = liveModel;
    [self.headerButton sd_setImageWithURL:[NSURL URLWithString:liveModel.anchor.avatar] forState:UIControlStateNormal placeholderImage:defaultImgae];
    [self.coverImageView sd_setImageWithURL:[NSURL URLWithString:liveModel.cover]];
    self.titleLable.text = liveModel.title;
    self.nameLabel.text = liveModel.anchor.name;
    if([liveModel.anchor.userId isEqualToString:[LTClient sharedClient].currentUserId])
    {
        self.deleteButton.hidden = NO;
    }else
    {
        self.deleteButton.hidden = YES;
    }
}
- (IBAction)deleteClick:(UIButton *)sender {
    
    if(self.deleteBlock)
    {
        self.deleteBlock(self.liveModel);
    }
    
    
    
    
}


@end
